package com.example.stock.comm;

import java.util.List;

public enum FreqEnum {
    MIN5, MIN15,
    MIN1, MIN30, MIN60, MIN120, DAY, MON1, MON3, MON6, YEAR,
    ;

    public static FreqEnum getByNameExt(String name) {
        for (FreqEnum value : FreqEnum.values()) {
            if (value.name().equalsIgnoreCase(name)) {
                return value;
            }
        }
        throw new RuntimeException("不包含该枚举");
    }

    public List<String> listTime() {
        final List<String> freqList;
        switch (this) {
            case DAY:
                freqList = Cons.timeDay;
                break;
            case MIN15:
                freqList = Cons.time15Min;
                break;
            case MIN30:
                freqList = Cons.time30Min;
                break;
            case MIN60:
                freqList = Cons.time60Min;
                break;
            case MIN120:
                freqList = Cons.time120Min;
                break;
            default:
                throw new RuntimeException("freq 枚举有误");
        }
        return freqList;
    }
}
